package com.gilight.base.service.impl;

import com.gilight.base.dao.SysIconMapper;
import com.gilight.base.model.SysIcon;
import com.gilight.base.service.SysIconService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysIconServiceImpl implements SysIconService {

    @Resource
    private SysIconMapper sysIconMapper;

    @Override
    public List<SysIcon> findList() {
        return sysIconMapper.findList();
    }

    @Override
    public SysIcon selectByPrimaryKey(Long id) {
        return sysIconMapper.selectByPrimaryKey(id);
    }

    @Override
    public void addIcon(SysIcon sysIcon) {
        sysIconMapper.insertSelective(sysIcon);
    }

    @Override
    public void updateIcon(SysIcon sysIcon) {
        sysIconMapper.updateByPrimaryKeySelective(sysIcon);
    }

    @Override
    public void deleteIconById(Long id) {
        sysIconMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void deleteIconByIds(String ids) {
       if (ids!=null&& ids.length()>0){
           String[] split = ids.split(",");
           for (int i = 0; i <split.length ; i++) {
                sysIconMapper.deleteByPrimaryKey((long) Integer.parseInt(split[i]));
           }
       }
    }

    @Override
    public void deleteIconBatch(String[] ids) {
        sysIconMapper.deleteIconByIds(ids);
    }

}
